#!/bin/sh
# Common parameters
SUBJ="/C=CN/ST=BJ/L=BeiJing/O=MyCompany/CN=MyDomain"

# Generate server cert
echo "[+++: server: server.key, server.csr, server.crt]"
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -batch -subj $SUBJ
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
cat server.key server.crt > server.pem

echo "[+++: verify: server.crt]"
openssl verify -CAfile ca.crt server.crt
openssl x509 -noout -text -in server.crt

